<?php include('brand_header.php');?>
<script type="text/javascript">
$(function(){
/*$("input[@name='star2']").each(function(){
 if(this.checked) $('#bzf').append(this.value+'分');
	});
// $('.test',this).html('');
 $('input[name="star1"]',this).each(function(){
 if(this.checked) $('#kwf').append(this.value+'分');
	});
 return false;
// alert(this);
 //});
$("#bzf :radio").click(function(){
alert(this);
}); */
 $('.hover-star').rating({
    focus: function(value, link){
    var tip = $('#hover-test');
    tip[0].data = tip[0].data || tip.html();
    tip.html(link.title || 'value: '+value);
  }
 });
 $('.hover-star1').rating({
    focus: function(value, link){
    var tip = $('#hover-test1');
    tip[0].data = tip[0].data || tip.html();
    tip.html(link.title || 'value: '+value);
  }
 });

$(".showimg_s ").click(function(){
		$(".showimg_s ").removeClass("this");
		$(this).addClass("this");
		var e = $(".showimg_s ").index(this);
		$(".showimg").hide();
		$(".showimg").eq(e).show();
	})
	$(".product_title a").click(function(){
		$(".product_title a").removeClass("on");
		$(this).addClass("on");
		var e = $(".product_title a").index(this);
		$(".tab_t").hide();
		$(".tab_t").eq(e).show();
	})


});

function favorite(uid,recommendid){
	$.ajax({
		url: 'index.php?mod=brandindex&code=nav',
		type: 'GET',
		dataType: 'text',
		cache:false,
		data: 'uid='+uid+'&recommendid='+recommendid,
		success: function(d){
		 if(d=='re'){
				art.dialog({
				title: '提示', 
				content:'请先登录！',
				time: 3000
			})	
		 }else{
		  $('#sc_'+recommendid).html(d);
			art.dialog({
				title: '提示', 
				content:d,
				time: 1000
			})	
		 }
		}	
	})
}
function recommend(uid,id){
	$.ajax({
		url: 'index.php?mod=brandindex&code=nav',
		type: 'GET',
		dataType: 'text',
		cache:false,
		data: 'uid='+uid+'&id='+id,
		success: function(d){
		    if(d=='re'){
				art.dialog({
				title: '提示', 
				content:'请先登录！',
				time: 3000
			})	
		 }else{
		  $('#tj_'+id).html(d);
			art.dialog({
				title: '提示', 
				content:d,
				time: 1000
			})	
		 }
		}	
	})
}
function pushcomment(){
    var formParam = $("#comt").serialize();
	$.ajax({
		url: 'index.php?mod=brandindex&code=comment',
		type: 'POST',
		cache:false,
		dataType: 'html',
		data: formParam,
		success: function(d){
		    if(d==''){
			art.dialog({
				title: '提示', 
				content:'请输入留言信息',
				time: 1000
			})	
			}else if(d==1){
			art.dialog({
				title: '提示', 
				content:'请先登录',
				time: 1000
			})	
			}
			else{
		    $('#procomments').prepend(d);
			$('#content').html('');
			art.dialog({
				title: '提示', 
				content:'留言成功',
				time: 2000
			})	
			}	
		}
	})
}
</script>
<!--主体内容-->
<div class="brand_nav">
  <div id="brand_nav_left">
  	<div class="title">品牌分类</div>
  	<div class="nav_search">
    	<input type="text" value="" class="nav_search_name" />
    	<input type="submit" value="搜索"  class="nav_search_submit"/>
    	<input type="text" value="" class="nav_search_list" />
  		<div class="float_both"></div>
    </div>
    <div class="title title2">产品索引</div>
  	<div class="nav">
    	<ul>
       <?php foreach($brandtype_list as  $key=>$vals){?>
        <li class="menu">+ <?php echo $key;?></li>
		<?php foreach($vals as $val){?>
        <li><a href="index.php?mod=brandindex&code=nav&serid=<?php echo  $val[0];?>"><?php echo  $val[1];?></a></li>
       <?php }}?>
        </ul>
    </div>
  </div>
  <div id="brand_nav_right">
  	<div class="brand_nav_right">
    	<div class="bread"><a href="###">首页</a> > <a href="index.php?mod=brandindex&code=nav">品牌导航</a> > <a href="index.php?mod=brandindex&code=nav&serid=<?php echo $tobnav['id'];?>"><?php echo $tobnav['brandseri'];?></a> > <?php echo $todetail['tobacco_name'];?></div>
        <div class="brand_product mt12">
        	<div class="left">
			    <div class="showimg"><img src="images/brand/<?php echo $todetail['pic'];?>" /></div>
				<?php foreach($morepics as $picss){?>
			    <div class="showimg" style="display:none"><img src="images/brand/<?php echo $picss;?>" /></div>
            	<?php }?>
            	<div class="showimg_s this"><img src="images/brand/<?php echo $todetail['pic'];?>" /></div>
				<?php foreach($morepics as $picss){?>
			   <div class="showimg_s"><img src="images/brand/<?php echo $picss;?>" /></div>
            	<?php }?>
            </div>
            <div class="right">
            	<h1><?php echo $todetail['tobacco_name'];?></h1>
            	
        		<span class="price">批发价：<i><?php echo $todetail['w_price'];?></i>&nbsp;&nbsp;&nbsp;零售指导价：<i><?php echo $todetail['r_price'];?></i></span>
            	<p><?php echo $todetail['intro'];?>
</p>
                <span class="collect"><a href="javascript:void(0);" onclick="favorite('<?php echo $_COOKIE['MEMBER_ID']; ?>','<?php echo $this->Get['ids']; ?>')" id="sc_<?php echo $this->Get['ids']; ?>">收藏</a> <a href="javascript:void(0);" onclick="recommend('<?php echo $_COOKIE['MEMBER_ID']; ?>','<?php echo $this->Get['ids']; ?>')" id="tj_<?php $this->Get['ids']; ?>">推荐</a></span>
               
                <div class="float_both"></div>
            </div>
        </div>
  		<div class="float_both"></div>
		<div class="product_title">
		<ul class="idTabs"> 
       <li><a href="#jquery">商品特征</a></li> 
       <li><a id="showcomm" href="#official">留言评价</a></li> 
         </ul> 
		</div>
		<div id="jquery">
		<div class="product_data"><span>品类：</span><?php echo $todetail['pinlei'];?><span>生产企业：</span><?php echo $tobnav['company'];?><span>品牌规格：</span><?php echo $todetail['standard'];?><br /><span>盒包条形码：</span><?php echo $todetail['hBarcode'];?><span>条包条形码：</span><?php echo $todetail['tBarcode'];?><br /><span>产品类型：<?php echo $todetail['producttype'];?></span><span>包装规格：<?php echo $todetail['package'];?></span></div>
  		<div class="float_both"></div>
        <div class="product_description">产品介绍：</div>
		<div class="product_content">
      <p align="center"><img src="images/brand/<?php echo $todetail['pic'];?>" width="492" height="442" align="middle" /></p>
      <p> <?php echo $todetail['intro'];?>
      </p>
		</div>
        <div class="float_both"></div>
		</div>
		<div id="official">
		 <form name="comt" id="comt" method="post" >
		 <div class="product_appraise mt12">
        	<dl class="line">
			
            <dt>已有<?php echo $k;?>位网友评价</dt>
           <dd><span>口味</span><span class="appraise_line green"><b style="width:<?php echo round(200*($perkw/5));?>px;"></b></span><span><?php echo $perbz;?>分</span></dd>
            <dd><span>包装</span><span class="appraise_line green"><b style="width:<?php echo round(200*($perbz/5));?>px;"></b></span><span><?php echo $perkw;?>分</span></dd>
            <dd><span>综合</span><span class="appraise_line orange"><b style="width:<?php echo round(200*($perzh/5));?>px;"></b></span><span><?php echo $perzh;?>分</span></dd>
            </dl>
        
        	<dl>
            <dt>如果您熟悉该产品，请给出评价</dt>
            <dd id='kwf' style="line-height:26px;">口味 <input name="star1" type="radio" class="hover-star" value="1" title="1 分"/> 
				<input name="star1" type="radio" class="hover-star" value="2" title="2 分"/>  
				<input name="star1" type="radio" class="hover-star" value="3" title="3 分"/>   
				<input name="star1" type="radio" class="hover-star" value="4" title="4 分"/>
				<input name="star1" type="radio" class="hover-star" value="5" title="5 分"/>
				<span id="hover-test" style="margin:0 0 0 20px;">0分</span>
			</dd>
            <dd id="bzf" style="line-height:26px;">包装 <input name="star2" type="radio" class="hover-star1" value="1" title="1 分"/> 
				<input name="star2" type="radio" class="hover-star1" value="2" title="2 分"/>  
				<input name="star2" type="radio" class="hover-star1" value="3" title="3 分"/>   
				<input name="star2" type="radio" class="hover-star1" value="4" title="4 分"/>
				<input name="star2" type="radio" class="hover-star1" value="5" title="5 分"/>
				<span id="hover-test1" style="margin:0 0 0 20px;">0分</span></dd>
            <dd>请在评分条中给出您的评价</dd>
            </dl>
  			<div class="float_both"></div>
        </div>
		 <div class="product_post mt12">
		
        <textarea cols="" rows="5" id="content" name="content">输入文字...</textarea>
    	<label for="weibo"><input type="checkbox" name="weibo" id="weibo" />同时转发到我的微博 </label>
		<input type="hidden" name="userid" id="userid" value="<?php echo $_COOKIE['MEMBER_ID'];?>"/>
		<input type="hidden" name="tobid" id="tobid" value="<?php echo $ids; ?>"/>
        <input type="button" value="留言评价" class="submit" onclick="pushcomment()"/>
		</form>
        </div>
		<div class="float_both"></div>
		<div class="product_title">全部评价(<?php echo count($liuyan_list);?>)</div>
		 <div class="product_comments" id="procomments">
		 <?php foreach($liuyan_list as $liuyan){?>
        	<dl>
            	<dt><a href="###"><img src="<?php echo $liuyan['face'];?>" width="40" height="40" /><br /><?php echo $liuyan['username'];?></a></dt>
            	<dd class="text"><?php echo $liuyan['content'];?></dd>
            	<dd class="date"><?php echo $liuyan['posttime'];?></dd>
            </dl>
	 		<div class="float_both"></div>
        <?php }?>
			</div>
		</div>
  	</div>
  </div>
  <div class="float_both"></div>
</div>
<?php if( isset($this->Get['comm']) ) { ?>
<script type="text/javascript">
$(function(){  $("#showcomm").click();  });
</script>
<?php } ?>
<!--底部-->
<?php include_once 'brand_footer.php' ;?>
